import Vue from "vue";
import VueRouter from "vue-router";

import home from "@/views/home/index.vue"
import list from "@/views/list/index.vue"
import detail from "@/views/detail/index.vue"
import regist from "@/views/regist/index.vue"
import login from "@/views/login/index.vue"
import error from "@/views/error/index.vue"
import cart from "@/views/cart/index.vue"
import order from "@/views/order/index.vue"
import orderList from "@/views/order/list.vue"
import test from "@/views/test/index.vue"


Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: home,
  },
  {
    path: "/list/:id",
    name: "list",
    component: list,
  },
  {
    path: "/detail/:id",
    name: "detail",
    component: detail,
  }
  ,{
    path: "/regist",
    name: "regist",
    component: regist,
  }
  ,{
    path: "/login",
    name: "login",
    component: login,
  } 
  ,{
    path: "/error/:message",
    name: "error",
    component: error,
  }
  ,{
    path: "/cart",
    name: "cart",
    component: cart,
  }
  ,{
    path: "/order",
    name: "order",
    component: order,
  }
  ,{
    path: "/order/list",
    name: "orderList",
    component: orderList,
  }
  ,{
    path: "/test",
    name: "test",
    component: test,
  }
 
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
